package manayShape_Polymorphism2;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;

//Cage:笼子
public class Cage2 {
    public static void main(String[] args) {
        ArrayList a=new ArrayList();
        a.add(21);
        a.add(12);

        Comparator compa=new Comparator() {
            public int compare(Object o1, Object o2) {
                return (Integer) o1-(Integer) o2;
            }
        };

        Collections.sort(a,compa);//Comparator接口创建一个对象当做排序规则

        System.out.println(a);//12,21
    }

}



//Animal[]  animals=new Animal[2];

